package com.wanqing.community.dao.impl;

import com.wanqing.community.bean.GoodsBean;
import com.wanqing.community.dao.GoodsDao;
import com.wanqing.community.dao.util.MyBatisDao;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * Created by pc on 2016/2/14.
 */
@Repository("goodsDao")
public class GoodsDaoImpl extends MyBatisDao<GoodsBean, String> implements GoodsDao{

    private final String NAMES_SPACE = "com.wanqing.community.bean.GoodsBean";

    @Override
    public int getGoodsCount(Map<String, Object> mapPram) {
        return this.getCount(NAMES_SPACE + ".getGoodsCount",mapPram);
    }

    @Override
    public List<GoodsBean> getGoods(Map<String, Object> mapPram) {
        return this.queryForList(NAMES_SPACE + ".getGoods",mapPram);
    }

    @Override
    public int addGood(GoodsBean goodsBean) {
        return this.save(NAMES_SPACE + ".addGood", goodsBean);
    }

    @Override
    public int updateGood(GoodsBean goodsBean) {
        return this.update(NAMES_SPACE + ".updateGood", goodsBean);
    }

    @Override
    public int deleteGoods(List<String> list) {
        return this.deleteBatchById(NAMES_SPACE + ".deleteGoods", list);
    }

    @Override
    public GoodsBean findGoodsById(String id) {
        return this.findObjectById(NAMES_SPACE + ".findGoodsById", id);
    }
}
